package com.mybook.controller;

import com.mybook.entity.Category;
import com.mybook.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("cate")
@CrossOrigin
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @RequestMapping("getAllCates")
    @ResponseBody
    public List<Category> getAllCatesData(){
        return categoryService.getAllCates();
    }
}
